package com.uxbee.pojo;

import java.io.Serializable;
import java.util.Date;

import javax.persistence.Version;

// 抓取数据
public class HtmlData implements Serializable {

	/**
	 * Create date:2012-9-22 Describe :TODO
	 */
	private static final long serialVersionUID = 1172905712867135471L;

	// 数据ID
	private Long id;

	// HTML内容
	private String content;

	// HTML抓取时间
	private Date time;

	// URL地址
	private String url;

	// HTML主域名
	private String mainUrl;

	// HTML内容MD5码
	private String md5;

	// 深度
	private Integer level;

	// 抓取完成标志
	private String finish;

	// 错误次数
	private Integer errorCount;

	@Override
	public boolean equals(Object obj) {
		if (obj == null) {
			return false;
		}
		if (!(obj instanceof HtmlData)) {
			return false;
		}
		HtmlData htmlData = (HtmlData) obj;
		if ((this.getUrl() == null || this.getUrl().length() == 0)
				&& (htmlData.getUrl() == null || htmlData.getUrl().length() == 0)) {
			return true;
		}
		if (this.getUrl() == null || this.getUrl().length() == 0){
			return false;
		}
		if (htmlData.getUrl() == null || htmlData.getUrl().length() == 0){
			return false;
		}
		return this.getUrl().equals(htmlData.getUrl());
	}

	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public String getContent() {
		return content;
	}

	public void setContent(String content) {
		this.content = content;
	}

	public Date getTime() {
		return time;
	}

	public void setTime(Date time) {
		this.time = time;
	}

	public String getUrl() {
		return url;
	}

	public void setUrl(String url) {
		this.url = url;
	}

	public String getMd5() {
		return md5;
	}

	public void setMd5(String md5) {
		this.md5 = md5;
	}

	public Integer getLevel() {
		return level;
	}

	public void setLevel(Integer level) {
		this.level = level;
	}

	public String getFinish() {
		return finish;
	}

	public void setFinish(String finish) {
		this.finish = finish;
	}

	public Integer getErrorCount() {
		return errorCount;
	}

	public void setErrorCount(Integer errorCount) {
		this.errorCount = errorCount;
	}

	public String getMainUrl() {
		return mainUrl;
	}

	public void setMainUrl(String mainUrl) {
		this.mainUrl = mainUrl;
	}
}
